#ifndef __TYPE_TRAITS_DEMO_H__
#define __TYPE_TRAITS_DEMO_H__

#include <iostream>
#include <type_traits>

// 二维点结构 struct Point2D
struct Point2D
{
    double x, y;

    Point2D(double x = 0, double y = 0) : x(x), y(y) {}
    bool operator==(const Point2D& other) const { return x == other.x && y == other.y; }
};

// 三维点结构
struct Point3D
{
    double x, y, z;

    Point3D(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {}
    bool operator==(const Point3D& other) const
    {
        return x == other.x && y == other.y && z == other.z;
    }
};

// 实现模板函数（编译时分支）
template <typename Point>
void judgeType()
{
    if constexpr (std::is_same_v<Point, Point2D>)
    {
        std::cout << "Point2D" << std::endl;
    }
    else if constexpr (std::is_same_v<Point, Point3D>)
    {
        std::cout << "Point3D" << std::endl;
    }
    else
    {
        std::cout << "Unknown Point Type" << std::endl;
    }
}

#endif  // __TYPE_TRAITS_DEMO_H__